<template>
  <!-- v-bind="$attrs" -->

  <a-input :value="data?.name" @click="openFn" :disabled="props.isAdd" placeholder="请选择" />
  <!--  <a-button type="primary" style="margin-top: 10px" v-if="props.isAdd&&isUpdate">添加人员</a-button>-->
  <SelectOrderModal
    @register="registerModal"
    @success="handleSuccess"
    :mode="props.mode"
  ></SelectOrderModal>
</template>

<script lang="ts" setup>
  import SelectOrderModal from './SelectOrderModal.vue';
  import { useModal } from '@/components/Modal';
  import { ref, computed } from 'vue';
  import { useMessage } from '@/hooks/web/useMessage';
  import { useUserStore } from '@/store/modules/user';
  const userStore = useUserStore();
  import { useAttrs } from '@vben/hooks';
  const attrs = useAttrs();
  const data = computed(() => attrs.value.value);

  defineOptions({ name: 'SelectOrderIndex' });
  const props = defineProps({
    mode: { type: String, default: 'single' },
    isAdd: { type: Boolean, default: false },
  });

  // , 'update:value'

  const emit = defineEmits(['change', 'onSubmitFn']);
  const [registerModal, { openModal }] = useModal();
  const { createMessage } = useMessage();

  const options = ref([]);

  function openFn() {
    // console.log("---props.mode222",props.mode)
    //console.log("--ids::",props.ids)
    openModal(true, data.value);
  }
  function handleSuccess(obj) {
    // let obj=list[0];
    // emit("change",obj);
    // emit("onChange",obj);
    emit('onSubmitFn', obj);
    // props.onSubmitFn(obj)
  }
  function onLoadDataFn(ids) {
    // console.log("---接收数据:",ids)
  }
</script>

<style scoped></style>
